Python else and elif statement syntax, pythonelif
Else and elif statements can also be called clauses because they cannot be used independently. Both of them appear in the if, for, and while statements. An else clause can be added. The elif clause
Reprint: http://blog.chinaunix.net/uid-26854432-id-3181585.html #if语句
#if语句会计算它后面的表达式, and checks the result of the expression, if the result is true (true), the subsequent statement is compiled, and if False (false), the subsequent statement is
In the shell of Linux
The IF statement determines which branch to execute through the relational operator to determine the true or false of an expression. The Shell has three kinds of if ... else statements:
If ... fi statement;
if ... else .
elif statements(equivalent to the else if in C language)In Python, when we need to have more judgment, we tend to use a different syntax, that is, using elif:if Judging condition 1: executing statement 1 elif Judging condition 2:
Original articles, reproduced please indicate the source, thank you.Author: Qing Lin, blog name: Flying Air and static crossing
#if语句
#if语句会计算它后面的表达式, and checks the result of the expression, if the result is true (true), the subsequent statement
If statement:1, if ... elif elif ... else, where else is optional, if and elif have the same indentation, at the end of a line there is a colonFor statement:2. Unlike C and Pascal, Python's for statement iterates through all the item in the sequence
1 naming conventions for variable names:Consists of numbers, letters, and underscores, but you cannot name a variable with a number. For example A, B, C, name, User1 user_id, and so on can be used as variable names.1A,2B 3CD and so on are not.
Basic shell syntax and shell syntax
I. Variables
1. Naming rules for variables: The name should start with a letter or underline followed by numbers, letters or underscores. It is best not to name it casually, so that you can see the variable name
In fact, python is a real dynamic language. The variable name in the Code is not "declared" or "defined, the language itself does not provide any special syntax for declaring or defining variables (except global ). For programmers, This is a benefit
Use python to design HTML-Based C language syntax to highlight the display program1st-school year semesterCompilation and translation principleCourse schedule reportClass 02 (II)Student ID 19Name: Liu XiaomingScoreInstructor Lu chaohuiI.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.